#include "pch.h"
#include "LinkSeqStack.h"

void InitStack(LinkStack *stack) {
	*stack = NULL;
}

void push(LinkStack *stack, ElemType x) {
	StackNode *p = (StackNode*)malloc(sizeof(StackNode));
	assert(p != NULL);

	p->data = x;
	if (*stack == NULL) {
		*stack = p;
		p->next = NULL;
	}
	else {
		p->next = *stack;
		*stack = p;
	}
}
